package emailsender;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
/**MailAuthenticator allow to the sender to log in the mail server
 * @author Marcello Maggioni*/
public class MailAuthenticator extends Authenticator 
{
    private PasswordAuthentication pwda = null;    
    /**Constructs an instance of MailAuthenticator that allow to log in a server with
     * the passed parameters.
     * @param username the username of the user who whants to log in
       @param password the password of the user*/
    public MailAuthenticator(String username, String password) 
    {
        pwda = new PasswordAuthentication(username, password);
    }
    @Override
    public PasswordAuthentication getPasswordAuthentication()
    {
        return pwda;
    }
}
